package com.learning.dynamic.executor.config;

import com.learning.dynamic.executor.executor.DynamicExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author Wang Xu
 * @date 2023/11/7
 */
public class DynamicExecutorPostProcessor implements BeanPostProcessor {
    Logger logger = LoggerFactory.getLogger(DynamicExecutorPostProcessor.class);

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof DynamicExecutor) {
            logger.info("DynamicExecutor [{}] load finished", beanName);
        }
        return bean;
    }
}